﻿using System;
using System.IO;
using System.Text;
using System.Collections;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text.RegularExpressions;


namespace EpisodeWizard.Core
{

    /// <summary>
    /// Helper class
    /// </summary>
    static class Helpers
    {


        /// <summary>
        /// Create the list of files that match
        /// - A movie extension
        /// - A reasonable size, for example > 50Mo
        /// </summary>
        public static List<string> GetMovieFiles(string Path)
        {
			List<string> Files = new List<string>();

            DirectoryWalker walker = new DirectoryWalker();
            walker.WalkDirectories(Path);
            if (walker.ErrorCode == ImportErrorCode.None)
            {
                foreach (string Filename in walker.FileList)
                {
					string Extensions = "*.avi;*.mpg;*.mpeg;*.wmv;*.divx;*.mkv;*.flv";
                    int MinSize = 50 * 1024;	// 50MB

                    FileInfo FI = new FileInfo(Filename);
                    if (Extensions.IndexOf(FI.Extension) != -1 && FI.Length >= MinSize)
                    {
                        Files.Add(Filename);
                    }
                }
            }

            return Files;
        }

    }
}

